import { ViewChild, forwardRef, Injector } from '@angular/core';
import { NgForm } from '@angular/forms';
import { bing } from '../index';

/**
 * 表单编辑组件基类
 */
export abstract class FormComponentBase {
    /**
     * 操作库
     */
    protected bing = bing;
    /**
     * 表单
     */
    @ViewChild( forwardRef( () => NgForm ) ) protected form: NgForm;

    /**
     * 初始化
     * @param injector 注入器
     */
    constructor( public injector: Injector ) {
        bing.ioc.componentInjector = injector;
    }
}